#!/bin/bash

echo 'run maven from docker --------'
docker run --rm \
 -v $(pwd):/build \
 -v /tmp/m2:/root/.m2 \
 maven:3-jdk-8-alpine \
 mvn clean package --settings /build/maven-aliyun.xml -f /build/pom.xml

# echo 'docker build --------'
# docker build -t helloworld .
# docker images helloworld

# echo "docker run helloworld --------"
# docker run --rm -it --name helloworld -p 8080:8080 helloworld catalina.sh run

# docker run --rm -it -v $(pwd):/build maven:3-jdk-8-alpine jar -tf /build/target/helloworld.war

echo "test helloworld --------"
docker run --rm -it \
--name helloworld -p 8080:8080 \
-v $(pwd)/target/helloworld:/usr/local/tomcat/webapps/ROOT \
tomcat:8-alpine catalina.sh run

